<template>
	<view>
		<view class="flex flex-y-center flex-x-between b-b llItem" v-for="item in dataList" :key="item.id">
			<view class="f-28 col-333">{{item.position?item.position+'：':''}}{{item.name}}</view>
			<view class="f-28 col-333" @click="callPhone(item.phone)">{{item.phone}}</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		getCurrentInstance,
		nextTick
	} from "vue";
	import {
		contactUs
	} from "@/api/index.js";
	const dataList = ref([])
	const contactUsFn = () => {
		contactUs().then((res) => {
			if (res.code == 200) {
				dataList.value = res.rows
			}
		})
	}
	contactUsFn()
	const callPhone = (phone) => {
		uni.makePhoneCall({
			phoneNumber: phone,
			success: () => {
				console.log("成功拨打电话")
			},
			fail: (err) => {
				console.log(err.errCode)
				uni.showToast({
					title: '错误码：' + err.errCode.toString(),
					icon: "error"
				})
			}
		})
	}
</script>

<style lang="scss" scoped>
	.llItem {
		height: 88rpx;
		padding: 0 30rpx;
	}
</style>